from tkinter import *
import hashlib

root=Tk()

text=Text(root,width=30,height=5)
text.pack()

text.insert(INSERT,"i love you!!")

contents=text.get("1.0",END)

def getsign(contents):
    m=hashlib.md5(contents.encode())
    return m.digest()

sign=getsign(contents)

def check():
    contents=text.get("1.0",END)
    if sign!=getsign(contents):
        print("警报！")
    else:
        print("没事")

Button(root,text="检查",command=check).pack()

mainloop()
